UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0txjivoh1hEtlUD8N1SX249raczkDWM2WrGpuW7dVE=' 
WHERE 
  key_id = 'aac654f49f90c00852d9da1a3dd29f476e66a9e6af929cb189f13e65fb9d1161' 
  AND (
    token = 'P0txjivoh1hEtlUD8N1SX249raczkDWM2WrGpuW7dVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046