UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'piha128bY1ym/yjaW/fGeyhxTWQB+Nu5Q/pXHPuZ2cM=' 
WHERE 
  key_id = '019285aebc559decb73931a2faec21a6347f617c46d3af09d09dbb812d2b9f03' 
  AND (
    token = 'piha128bY1ym/yjaW/fGeyhxTWQB+Nu5Q/pXHPuZ2cM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031