UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3qaoIuMMYjMmNNErtrqJO46j0xtCs6E1rm5fMT97glk='
WHERE
key_id = '22d4069658b859bb8ff7891b4faf65739205cfc99c259385cb206dbdb522a3c1'
AND (
token = '3qaoIuMMYjMmNNErtrqJO46j0xtCs6E1rm5fMT97glk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)