UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XjAZ8Tq+M0LsAjN81lZQkc4Lz28HGB50WlXmqQxXio4='
WHERE
key_id = 'b3886fdce2d7538393c8b445c6e60d4e8d87b787bbe94f75528d6e62429a5b71'
AND (
token = 'XjAZ8Tq+M0LsAjN81lZQkc4Lz28HGB50WlXmqQxXio4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)