UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H9ZFFBgsImNQJbugBL5amj60aHuZlzC8W9YUtp+QlHQ='
WHERE
key_id = 'a895d1cc9dbd76077c92118164d4ee77479847299126a4e16a79fe4f7b47b8c7'
AND (
token = 'H9ZFFBgsImNQJbugBL5amj60aHuZlzC8W9YUtp+QlHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)