UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C+sRmJmAkwVoT2m05K1kmrLwfXk5d1FA64YXH2WtcTs='
WHERE
key_id = '8f519e4b07d2dff56b962389318c4016353d0c4a8657e08f1928b86ee7211fe1'
AND (
token = 'C+sRmJmAkwVoT2m05K1kmrLwfXk5d1FA64YXH2WtcTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)