UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tlP5DKuK9ltCi4xOUYzMWI+0W0YsOOOPjGQAt76THwM=' 
WHERE 
  key_id = '097250ab3f6dd59e660608eafca09fed2fa8f00c930539a09ed9442cc6966427' 
  AND (
    token = 'tlP5DKuK9ltCi4xOUYzMWI+0W0YsOOOPjGQAt76THwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052