UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B7KkIAzfwNcHBS2LzRAojbLPlZF0zTz0gcHx8VXy5cE='
WHERE
key_id = '14a4005327d82c757c23ee6be17dda491de01c486a8dad2ae0b17e5f02141596'
AND (
token = 'B7KkIAzfwNcHBS2LzRAojbLPlZF0zTz0gcHx8VXy5cE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)