UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5j/yJH5wD6gQX9wipBaqtrru9rDe6zpI4mbbPHb+I7E='
WHERE
key_id = '8bd501a5f5a256cb5fbd823c259a82caa0e034aee2007207e48e7b8ae98b28c3'
AND (
token = '5j/yJH5wD6gQX9wipBaqtrru9rDe6zpI4mbbPHb+I7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)