UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xkTrVjn6JCX3N8kBWDCz8qa3ppzxhjU4EdCwW2k87e0='
WHERE
key_id = '6ac8f41ad7654a72b8b766dad67d849a5612b8453a30384aebfd45ae5ee83201'
AND (
token = 'xkTrVjn6JCX3N8kBWDCz8qa3ppzxhjU4EdCwW2k87e0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)