UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+4nwKiC6Va6Tc/WqSOrnCTV01ApDnbbwBOw2LZWTF8U='
WHERE
key_id = 'b9e71c78862dc34bc71d09888e27da7dadd637edf565a9dfcf47aa4546ed2604'
AND (
token = '+4nwKiC6Va6Tc/WqSOrnCTV01ApDnbbwBOw2LZWTF8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)