UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zg+2ySJcjCmXJawdbJbF7eRRPjK6cytvxm5pD3G+eKA='
WHERE
key_id = '4ede1d7ba0511eabf42a691d579429b8c7bf1cf152804b268a54422ec147e90a'
AND (
token = 'Zg+2ySJcjCmXJawdbJbF7eRRPjK6cytvxm5pD3G+eKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)