UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iXnS0BwJsdNzwTb1TvfrLobH+D6oQ5QCIOhvupebh+g='
WHERE
key_id = '6bd19ec14593646e8e18426570543b39e2f9d216661461edbf0a191b050881bd'
AND (
token = 'iXnS0BwJsdNzwTb1TvfrLobH+D6oQ5QCIOhvupebh+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)