UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B0qLiCdAut5HOCmphvfyOGl4JgbqPXZSYc1XB7LIyw0=' 
WHERE 
  key_id = '76b974e9844217b3c7d643761a480e7809c55e2bf4e82a0acf17f019a16fdcb1' 
  AND (
    token = 'B0qLiCdAut5HOCmphvfyOGl4JgbqPXZSYc1XB7LIyw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044