UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6XT13ghkPl+mJA6CHtdNO1dPVdnmvkW+65QGtWjcnZc='
WHERE
key_id = 'd9d0cbb5ec200e56cde618c9b90bc4631706499ea6884d275f6a815b9fe625b6'
AND (
token = '6XT13ghkPl+mJA6CHtdNO1dPVdnmvkW+65QGtWjcnZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)