UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xC0umiPDXkU/+iFyoZ0394gupBlWacO/58mpfyyJQmw=' 
WHERE 
  key_id = '9370e22776a4208a7f82238109093afce7d2f5443334ae09f9f0e820a3855766' 
  AND (
    token = 'xC0umiPDXkU/+iFyoZ0394gupBlWacO/58mpfyyJQmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029