UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rE/n7BCWa1FEoNtRtz9uam4gLGMs5SAFosWddko4X2s=' 
WHERE 
  key_id = '8250317d32b796fc3bb691a0b265c8fda7c637f459ff63d60d769b44734d59d0' 
  AND (
    token = 'rE/n7BCWa1FEoNtRtz9uam4gLGMs5SAFosWddko4X2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041