UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BERCrWe3mwivFKJr2R8Rg/Bi67ooIgSSAFjRhz4D8jc='
WHERE
key_id = 'bcc48625b341a6fff86d88f1545deec71588544c0f99969a2eabe5ea3399ef2c'
AND (
token = 'BERCrWe3mwivFKJr2R8Rg/Bi67ooIgSSAFjRhz4D8jc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)