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

Query time 0.00029