UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JSPSwCWfby5tBCMLg1CcGVTeZz+ToCVeowm0DEszOfc=' 
WHERE 
  key_id = '1fc5c69ea8d1262feaadafae967209b1b73966e6a3666a79f3bb165774cbf1f1' 
  AND (
    token = 'JSPSwCWfby5tBCMLg1CcGVTeZz+ToCVeowm0DEszOfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00100