UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BW1kXSs3/sIXMXKIbW+pRF7UtOGTbg0O2EgADIw1Cl0=' 
WHERE 
  key_id = '6413d7d2126ec7be93131e391110a8e3f9df19ede48ab10c64d706bfedffada5' 
  AND (
    token = 'BW1kXSs3/sIXMXKIbW+pRF7UtOGTbg0O2EgADIw1Cl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015