UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2IEY4Qcq9xgZBl2cKxFVhV4wlrjNyNhoL4/EuauEdAw=' 
WHERE 
  key_id = 'f8b52f6813ad53966aac9f9e5f2f58e07d9f3bae024285e3c7566df15eb6321d' 
  AND (
    token = '2IEY4Qcq9xgZBl2cKxFVhV4wlrjNyNhoL4/EuauEdAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034