UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRrN5FbCdIEzoRn93MJy/K87iMu++eMBIwvn8GnmDc0='
WHERE
key_id = '6e0b7fa8f5fafd209e1d5966538135d92583f507389d999e1d7ad0dbd3b17715'
AND (
token = 'xRrN5FbCdIEzoRn93MJy/K87iMu++eMBIwvn8GnmDc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)