UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZV28fUU5nMMucS132KPBuUoCY1PPf0hC+2dOtPRS2hE='
WHERE
key_id = 'f52173539c8ac374d49f6145bacdd4b108447730d9a3f18711d1db1d894f69c3'
AND (
token = 'ZV28fUU5nMMucS132KPBuUoCY1PPf0hC+2dOtPRS2hE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)