UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YsErkGG9ADHlr2Fi6C3cf7UCN+n7TJ9hrickg2/HERQ=' 
WHERE 
  key_id = '1f99ad0ca721f78dafaca34f009c372e29159c746ba7532153b46b44676345ee' 
  AND (
    token = 'YsErkGG9ADHlr2Fi6C3cf7UCN+n7TJ9hrickg2/HERQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040