UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DABRc65uX7xFHpu82lcN+vfh9j1XuAg3xmmg32FPGfI=' 
WHERE 
  key_id = '783f0f6b67b6277773c52cc795eb6260074b91a12cc197c8fb7f7a448d58efed' 
  AND (
    token = 'DABRc65uX7xFHpu82lcN+vfh9j1XuAg3xmmg32FPGfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025