UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ATWNTRCKtw3+fI5plylzDjttwCdxtuhUwZFVJ3NGqyc=' 
WHERE 
  key_id = '38813214782cc739b2617ebaea70ba5e3477b973ebaaafe1108e4ecf29fd9652' 
  AND (
    token = 'ATWNTRCKtw3+fI5plylzDjttwCdxtuhUwZFVJ3NGqyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029