UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'odLlzoYggUmN7JQwFNlAC2+tDYKrpwx5BuwjulC5EPc=' 
WHERE 
  key_id = '9991e26311287faf0ea6fcf4cc510b815e09154daefd66a4725ac74f31f62484' 
  AND (
    token = 'odLlzoYggUmN7JQwFNlAC2+tDYKrpwx5BuwjulC5EPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040