UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xtdgFLDFKxUo0viROVuOq1YmQN+47pKTBt0lp/HPTsw=' 
WHERE 
  key_id = '1790b1529b4dcb4c56fdc0d9c158624efbcddecd420c6f6c8406bfe63dce7bb3' 
  AND (
    token = 'xtdgFLDFKxUo0viROVuOq1YmQN+47pKTBt0lp/HPTsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045