UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sqUwdH8aKd3rgpnhEfUZs+3VmlZ1zgQTw+xzMRoolng=' 
WHERE 
  key_id = 'e37514f46e5fb2b673b43a53cacfa57d406584515ec95b03cf1dc79f94053c69' 
  AND (
    token = 'sqUwdH8aKd3rgpnhEfUZs+3VmlZ1zgQTw+xzMRoolng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023