UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bDZHh8IN8EAF+UMUlFLn2jHcaOBknHiPKrWhCG1+dsI='
WHERE
key_id = 'a9c5b94f4df114d3a5f4b8c4e27aa4f800979c385604ee65f50e61284acfb784'
AND (
token = 'bDZHh8IN8EAF+UMUlFLn2jHcaOBknHiPKrWhCG1+dsI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)