UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fs37dVAxOSBOkncWCuEHp+6hqIUvDaecGw72pa6Mgtc=' 
WHERE 
  key_id = '797a42ce8152f2ba9424f8f3528f1138d343c86a838e5ac47147eea285810ec1' 
  AND (
    token = 'Fs37dVAxOSBOkncWCuEHp+6hqIUvDaecGw72pa6Mgtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035