UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9St60aLUf0bTpTK8rjj9vxfVfNZhSMNear0K1x3VGhI='
WHERE
key_id = '3c67209297c7a795daf557adfb3d0fdd6371e767ab61cf77b7d7abe0b357bfde'
AND (
token = '9St60aLUf0bTpTK8rjj9vxfVfNZhSMNear0K1x3VGhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)