UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2+bXSu3p/hCzHOUe6cThSQ5T7pzBCHkfg2rXDUCye0='
WHERE
key_id = '17bfc4481d229c579f8352bc41c01312446dc5f019fc91b058c3393bdd017fff'
AND (
token = 'Z2+bXSu3p/hCzHOUe6cThSQ5T7pzBCHkfg2rXDUCye0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)