UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u2uQQSo2IuGaX+X56/tjSsu23AcervUPJew4IOtUrYI=' 
WHERE 
  key_id = '6b1732e17686cbedcab097e979d27e217b0d0049c2209afb7c9b4faf51254473' 
  AND (
    token = 'u2uQQSo2IuGaX+X56/tjSsu23AcervUPJew4IOtUrYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058