UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '29o2evOkaOHEaUVchxb8KrPwU+eSMHzS/YEypM5BnaI=' 
WHERE 
  key_id = '85362d793f336c398728ce536e62d290a8408c0a7d053858155d25e53b84bf65' 
  AND (
    token = '29o2evOkaOHEaUVchxb8KrPwU+eSMHzS/YEypM5BnaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052