UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k9ddEMFW4aE0b7tCvmw6huV/l3Y6TX14u9jrY4xDZR4=' 
WHERE 
  key_id = '0472e22b74abb19e5369320e8c2fe0934809338607f0463a80bf226c57aca9f7' 
  AND (
    token = 'k9ddEMFW4aE0b7tCvmw6huV/l3Y6TX14u9jrY4xDZR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023