UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'avOVdxtNJwvp4FjzVLJ3Zb+XD0nmyi13pPGK1vEPOHs='
WHERE
key_id = '79a5bdba449a16247b40fda9eb4955dabcda05465e9664b15bb45ef2347b07d5'
AND (
token = 'avOVdxtNJwvp4FjzVLJ3Zb+XD0nmyi13pPGK1vEPOHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)