UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fIzPn+ieQK+HgPZWtL5YmhUfhz5Sle+U8T93vxS6KE0='
WHERE
key_id = '5449e2420244df8b1386b680cde3186b9af81f4a10b15ca9c572b0f27978ea06'
AND (
token = 'fIzPn+ieQK+HgPZWtL5YmhUfhz5Sle+U8T93vxS6KE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)