UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1nQr3wbC94BBXstSEUvuQL7gsV0vfKaDeYs5cu9XpKU='
WHERE
key_id = 'f6c406e4f24b066cc3c2ecd337881c468653558d9859b12b76335e5a1c81c7dc'
AND (
token = '1nQr3wbC94BBXstSEUvuQL7gsV0vfKaDeYs5cu9XpKU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)