UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l7bO5ocrtKpbcJy5q/cTBeQb8D90Mv9LrKVU7w60ejo=' 
WHERE 
  key_id = 'c59028651849d6344af482c84da0e0aa9847955a92756312f836a6cb91aee775' 
  AND (
    token = 'l7bO5ocrtKpbcJy5q/cTBeQb8D90Mv9LrKVU7w60ejo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033