UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '78CB3dTYN1Ttwzq4SgbMpngnwCc889VyxV88OhVq+h4='
WHERE
key_id = '1e53b7bf36a59eecf455450ab56a72b00091a5470ffaa58861b4f0700949d590'
AND (
token = '78CB3dTYN1Ttwzq4SgbMpngnwCc889VyxV88OhVq+h4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)