UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cQGJ5rS648EsOjRjI+8z1X6w7nTUL7/o53FwZtaK9CY='
WHERE
key_id = 'a78ce78ea554e319aa774a81dcd381691e17529988c63419870d6e747ca2cb3b'
AND (
token = 'cQGJ5rS648EsOjRjI+8z1X6w7nTUL7/o53FwZtaK9CY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)