UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nsX6qqAJL6UlIQr+BR1F+UIKpMizz8vBEm8ymi4l/6o=' 
WHERE 
  key_id = '57d9f3ba2ad3e6fa0ede19762d6a9a7468c06c999fb18696c5c8967677906e08' 
  AND (
    token = 'nsX6qqAJL6UlIQr+BR1F+UIKpMizz8vBEm8ymi4l/6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059