UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uE7f+XzPdax4HFozPagBhXWMvwu5VcRuMvnnDpxef1s='
WHERE
key_id = 'cdd5d70188472cf475900e008ba75019c927d0ca608da99d975a2a175dcdfcde'
AND (
token = 'uE7f+XzPdax4HFozPagBhXWMvwu5VcRuMvnnDpxef1s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)