UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cW32pPSAxTXOHYB+iRSpzJNaYvj1MvnnBa8nLJRgV14=' 
WHERE 
  key_id = '9b026d798883bebd261494ad1786579e4015e72b21cc09ab1c6aa8e2904affc4' 
  AND (
    token = 'cW32pPSAxTXOHYB+iRSpzJNaYvj1MvnnBa8nLJRgV14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031