UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZZUf4uxMRjoM0RdQ8EyorYlKKv4FiuzEIWqdvH77Oqk='
WHERE
key_id = '8d8a873d32e262340ea6accfc1667a1b190b4241db37b7b458346e1ed7a440e8'
AND (
token = 'ZZUf4uxMRjoM0RdQ8EyorYlKKv4FiuzEIWqdvH77Oqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)