UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ocv3TTyjedR5w/3WUcjJHS2dap3FIkySdxR9T1B3ZM8=' 
WHERE 
  key_id = 'c410d38b4ac0ea000f63f24914bf1a5784f54fdb52ddb0f1c72e717f571c3639' 
  AND (
    token = 'ocv3TTyjedR5w/3WUcjJHS2dap3FIkySdxR9T1B3ZM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062