UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QNEOHZCDVB8qh8FAAkidB5b5f+t9SZ+KriLMd4rvqHg=' 
WHERE 
  key_id = '27367ecc3865de85c5e680c56ad0f35a6a16361a6eb6c19d55982ff4d88677ec' 
  AND (
    token = 'QNEOHZCDVB8qh8FAAkidB5b5f+t9SZ+KriLMd4rvqHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046