UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z2qubsVTTiT53N2vxiuxgYFou8f5irQkxcGH5Y2GDLk=' 
WHERE 
  key_id = '3a92a31c862ea393b4c809984c952a87597a9bb4da9c579c8564aeec24268949' 
  AND (
    token = 'Z2qubsVTTiT53N2vxiuxgYFou8f5irQkxcGH5Y2GDLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032