UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USm+D9PTXZhLagbBNq+ppUTmEokG3f3+6w/F94AL8xU=' 
WHERE 
  key_id = '758d403defdfd070ec63b35499b69e191c6b22d29973f45648adc531602c4de8' 
  AND (
    token = 'USm+D9PTXZhLagbBNq+ppUTmEokG3f3+6w/F94AL8xU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021