UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UirycTI4WqTzzuwpcZzOZMYs4gk21fJc5gO9OsNSeSI='
WHERE
key_id = 'd91dae05d8c7b81829ef3d16cf6796bf3418d810e8215885fb59d25d732c37a8'
AND (
token = 'UirycTI4WqTzzuwpcZzOZMYs4gk21fJc5gO9OsNSeSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)