UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Uv3+7DHjLqkw7o7elW3cEg5GaXlmM0NfnepWLowoDE='
WHERE
key_id = 'bef5eb1e0a44a95a1fa7fb09245a4fa63ff300b931494d7ebeb249fe9835095e'
AND (
token = '7Uv3+7DHjLqkw7o7elW3cEg5GaXlmM0NfnepWLowoDE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)