UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lBM7bFklopSMcS5j60EYRSDqnCazDdoB7OQg5yL7iGs=' 
WHERE 
  key_id = 'f52a54ec718ac508ba6bca72daa034319e0028745c2b4a908c399bd854179ae3' 
  AND (
    token = 'lBM7bFklopSMcS5j60EYRSDqnCazDdoB7OQg5yL7iGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030