UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Q6WtUak1OHa8wNCtZe1pppyewPBLFPNnbegEEV8EUg='
WHERE
key_id = '173c84e2cf5f2bc19df9c978bff79d076f59cb19e98d7115c637053c5c63ee46'
AND (
token = '3Q6WtUak1OHa8wNCtZe1pppyewPBLFPNnbegEEV8EUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)