UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGaqWOXQOii4zJ2HBu4apbxKayEk8uwVDMMNw7wpjFk='
WHERE
key_id = 'f8cc90c4e318d96cddee9347e933f9d651be21e9a67634cf608cf6801c0296a9'
AND (
token = 'XGaqWOXQOii4zJ2HBu4apbxKayEk8uwVDMMNw7wpjFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)