UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZZg0qzkhviqDmmc1w3vDKuZh6XQiPjRck8K17gWiGtg='
WHERE
key_id = '7b8930c95b9b5a72714a04925e3b0073ff3c580a105e43daedc3e908c655ef01'
AND (
token = 'ZZg0qzkhviqDmmc1w3vDKuZh6XQiPjRck8K17gWiGtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)