UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zJllxrsKHVjSVtyGH5S6QbrTP6+wR3FqoUgPlbukdm8='
WHERE
key_id = 'fdb18e148ec442c66667c3b1dff210031b2a167c7887b8b2f735d3487b2e102a'
AND (
token = 'zJllxrsKHVjSVtyGH5S6QbrTP6+wR3FqoUgPlbukdm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)