UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3lA7Ho+lpbq9L0F/dF1CXU1v8RLPBKGaJwyB7YAvm30='
WHERE
key_id = '4a74d9d474a2e3183de96104201e0d4598112b6adb27746f3a42d9edfe079901'
AND (
token = '3lA7Ho+lpbq9L0F/dF1CXU1v8RLPBKGaJwyB7YAvm30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)