UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4hbOhk6RYLmsbIhb/hCyNDUnQP5Icf1V1qTSJF/X9Us=' 
WHERE 
  key_id = '671f92aecb1ea4cd4913491bc22864d75c937f5710570566aaf01a4af27fd35d' 
  AND (
    token = '4hbOhk6RYLmsbIhb/hCyNDUnQP5Icf1V1qTSJF/X9Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021